import cn.edu.zut.cs.Business.CommunityService;
import cn.edu.zut.cs.Model.Community;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;

import java.util.Date;

import static org.testng.Assert.assertTrue;

@ContextConfiguration("classpath*:database-context.xml")
public class beantest extends AbstractTestNGSpringContextTests {

    @Autowired
    Community community;
    @Autowired
    CommunityService service;

    @Test
    public void beantest(){
        community.setName("nm");
        assertTrue(community!=null);
    }

    @Test
    public void insertcommunity(){
        community.setId(8);
        community.setName("扣扣");
        community.setSex("女");
        community.setTel("123465901");
        community.setTem((float)37.5);
        community.setTime(new Date());
        community.setState(1);
        System.out.print(community);
        service.insertCommunity(community);
    }

}
